!Copyright (c) 2013 by tdem.org under guide of Xiu Li(lixiu@chd.edu.cn)
!written by Huaifeng Sun(sunhuaifeng@gmail.com) and Xushan Lu(luxushan@gmail.com)
!Code distribution @ tdem.org or sunhuaifeng.com
    
SUBROUTINE FREE_MEMORY
  USE CONSTANTPARAMETERS
  USE ELECTROMAGNETIC_VARIABLES
  USE RES_MODEL_PARAMETER
  USE TIME_PARAMETER
  IMPLICIT NONE
  INTEGER ERR
  DEALLOCATE(EX, EY, EZ, STAT=ERR)
  DEALLOCATE(HX, HY, HZ, STAT=ERR)
  DEALLOCATE(CCSIG, STAT=ERR)
  DEALLOCATE(CTIME, STAT=ERR)
  DEALLOCATE(DELT, STAT=ERR)
  DEALLOCATE(CDELX,CDELY,CDELZ,STAT=ERR)
  RETURN
ENDSUBROUTINE FREE_MEMORY
